improved scandir algorithm and added scanpaths for
multiple input
improved flex styles
general refactorings