refactoring and reformatting

Signed-off-by: Thomas Schubert <funthomas424242@gmail.com>