Code cleanup, bit of refactoring
Code cleanup, bit of refactoring