cleaned up and made some amendments - nealry usable now