Refactor backbone code