code from second year hnd