Updated the code. Used helpers and authentication