Refactored chunk generating into util class