Ammended code

Register still doesn't work, but very close...