Cleanup/various fixes