Added verbose logging, fixed some gcc warnings