Refactored views and updated js handlers