Adding in the registration functionality and error logging