refactored code to be more DRY, using callbacks, cleaned up README and documentation