tidied the code