some more refactoring and a backup