Restructure

Fix everything up to make new algorithms easier to add.