More comments and code cleanup