converted to active record