General improvements and cleanup