start rewriting registration code