refactoring, fixing tests

Signed-off-by: RedChrome <redchrome@gmx.de>