halfdone code.