added actions.py - simplify logic in route functions