Working version. Make suitable to act as bookmarklet.