Refactor code #2