Made file handling more general, revised README and test scripts