updated main function to correctly call the new dispatcher like function