Moved register command to separate method.

Signed-off-by: Lucas Arnström <lucasarnstrom@gmail.com>