remove unused code and minor cleanup