Some tidying up and fix form bug.