This isn't my code, I just copied it from cPiston. Blame whoever wrote it :P