Implemented findClosestEmpty() method