Creating registration logic and fixing code issues