Improved keyword background painting, cleanup