Builds now without compiler warnings with lots of flags enabled. Fixed conversion problems and potential segfaults. Removed unused code, catched several blackholed return values and added autoconf compiler flag checks.