Added @if_logged_in decorator, plus some minor style changes