Refactored dispatcher code

Created functions - still need to add deployment and security functions