Add comments and fix build errors