simplified code for finding empty places