Refactor some code and add exercise module