a little bit code refactoring