Adaptation from Steve M work and things found online but not complete