decorators to remove lots of redundant code from api functions