code and style cleanup