Refactor some more
reformat code