create diff func