improve performance and refactor (fix #6)
+ implement "only_file" option