Added a type dispatching algorithm, still needs to be connected to the GUI