Tidied up code a lot and cleaned up file directory.