Cleanup and fix warnings