Cleaning up and bug fixes.