Holy crap this is bad code