tidied up code w/o classes so no need for classify branch.