refactoring and some playing around