working on refactoring
finished refactoring
fixed spacing/whitespace issues