Changed to dispatcher function style

More DRY and more loosly coupled.