Major refactoring:
 * Added support for specifying files and dirs on the command line instead of recursively traversing current directory
 * Added a library mode for inclusion in other scripts
 * Split code into functions
 * Added documentation for each function
 * Proper copyright header