add register functionality.