please add a comment for the endifs here, it starting to get confusing.