added register functionality.