reformat code and move things around