rearrange functions to make inheritance work correctly