moving functions / cleaning up