cleaning up registration code