Fixed and improved chunkify