move some aspects into their own source files, fix graphical glitches, allow alpha threshold setting