Various small improvements and bugfixes (warnings review)