Modified the code logic in html and controller, #275