Added checks for empty slots