fixed most compile errors
code compiles