Plugin TOTALLY rewritten.