Added support for single directory processing

Added some utility functions to reduce code reuse.
Making full use of custom struct instead of populating map