Registration functionality has been implemented.
It should be refactored, but it works.