implements all func except the deeper code of barcodefun