edited with solution (one view and one controller version)