general comments and code cleanup