Fixed problem with local variables thanks to Cody Brown.