Fixed compile errors in visual studio. Still some warnings. Will fix later.