Fix compile time issues, fix some formatting