Moved guard from view to controller