A bajillion bugfixes