Some refactoring & reformatting

Signed-off-by: Michael Steinert <mike.steinert@gmail.com>