Refactor diff/merge js controllers

Use polymorphism instead of if/else statements