Add decorator to run functions remotely or locally