-added error handling and logging
-unit tests
-cleanup