Changed directory input to file input to be more flexible