Refactored and improved tests and code for Inject