David Harvey's KS2 and KS4 code.
Merge remote-tracking branch 'wbhart/trunk' into trunk
fix bug in KS2 and KS4 and add test