Moving dispatch logic into a separate file.