Made some progress and fixed several stupid errors; simulation not functional yet