fixed, with some minor formatting and import rearranges