give file command line permission
reorganize for use as an importable library
modify readme to reflect code change