cleaned up your butt ugly code