refactor inline into classes