Refactoring

Refactored some stuff.