export function to dispatch commands