Refactoring

Some simple refactoring