cleaned up code with tidy.dir()