Refactored some code
Refactored some code