Changed the logic how HDFS files are handled. Other minor adjustments