Refactoring code #271