Final version; tested on Lisa, proven to work