Refactoring and minor changes

Signed-off-by: scottsavarie@gmail.com <158brunnenstrasse>