Changes for activerecord integration