changed structure to include dispatch method