Updated and tested using 4.8.1 with O2 and fixed compiler warnings