Redesigned the view and template code