performed refactoring

just changed the order of code.