Major bug fixes

Most minor changes with a far reaching affect.

Fixes #123, #122, #121, #116, #107