Introduced Batch class, refactoring