Implemented Martin's suggestion of dispatching

Can't wait to test it :)