refactor based on Ben's notes. v1
added local file for faster tests. added support for files or urls. refactoring.