add functools, and login_required, to implement sessions