Corrected bed touching logic, added comment.