Add code and refactor