stupid github editor added an extra '(' :argh:

also moved a couple declarations to inside a block