Max's "final" version. Still a lot of issues, though.