minor Refactoring and cleaning up