C: Added more comments and cleanup.