Added more structure and a rough draft of the base algorithms