Refactored code, added batch object and initial unit test