somewhat tidied
merged josh and tom