Refactoring slightly