Refactor part 1
Refactor done