moved file opening out of module scope so that Melanie's test files aren't opened merely by importing the module
(#389)
fixed wrong shift usage
(#389)