general code and comment cleanup to make it more readible for review