Some clean-up and small bug fixes.