changed code to be more modular, split concerns into folders and files