added before_action filters for extracting logged_in logic (some unnecessary code doing the same has been left on the views layer from before)