Refactored: Deduplicate code and more information encapsulation

Signed-off-by: Sven Strickroth <email@cs-ware.de>