some syntactical improvements, works with whitespaces in file names