added subfunctions