Rewrite processItem function