Refactor to simplify by using quasiquote