Some fixes and refactoring.
Added guest registration