Problem 007 refactor