subfunctions