rewrote dispatch() but its not working