Cleanup and misc fixing