Some clean-up and minor fixes