allow for filenames on the commandline
fix buffer length calculation
better documentation