refactoring a little bit...