Added more/minor refactoring