Added comments explaining large if conditional