refactoring a litle