work on register

an evenings work on the registerfunction, nothing working so far.