a bit more refactoring...