switched to activerecord