Major improvements and bug fixes.