More progress

Finished before writing. Fix bugs until it works