Fixed compile warnings

Modified lots of stuff