Refactor hw4.rkt