Form code pulled from old project. Minor changes to work standalone.