Added beginnings of validation to register function. Needs testing