refactored code

Signed-off-by: Max Stemplinger <ms@campudus.com>