restructure and refactor code gasoline