refactor data in api to have internal storage
restructure code
clean up