refactor code into modules which are replacable