Fixed last few compile errors, ready for testing