refactoring and adding stuff