refactor hw3 spec