changed to active record