Did some minor refactoring

more to come