refactor for activerecord conventions