fixed form bug, tidy up