refactor for cleaner seperation between api resources and data handlers