Misc refactoring
Refactoring