Refactored main.js to work with bind