added option parsing
added recursive option
added error handling