Moved some behaviour to one place

Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>