finished refactoring if/else statements and removed old code