added filtering out of directories, added passing error back to callback. Fixes #1 and #3