refactoring conditional statements and class name changed