Moved some of the action functionality from api.py to action.py. Now
about to clean up some of the (masses of) legacy lint.