Made the code slightly less butt ugly.