cleaning up & refactoring