Some clean-up and minor improvements