Code Refactoring

Just some simple refactoring.