Bugfixes, generally working