refactor using .to_proc to convert symbol into proc