Refactor based on Luke Daley's feedback.