Even more improvements and cleanup