refactored code with backbone views