benchmarking; slight improvements
took three and a half seconds off
another half a second off
removed local variables and re-organised the if-statements