Split up the pneumatics code
Make sure that the required variables are not undefined
Remove duplicate onchage handler
Whitespace cleanup