Latest version of Tera's code. I don't know if it works, though...