Replaced everything with (mostly) working, up-to-date code.