tidy up

fixed issues with auto tidy up and made more readble