improved searchOfferedApts function