Bugfixes and misc. Still needs work