Finished code refactoring for now