Added exception handling in file reading for dist file
Added actual implementation of --rev option in sorted file writing (forgot it!)