- Some refactoring and cleanup

Signed-off-by: Kristian Duske <kristian.duske@gmail.com>