Not commenting doesn't make something messy, it's a simple set of if statements, pretty self-explanatory...