filled out sub-functions