Cleanup and fixed some warnings