Tidied Main file