Now compiles, needs some tidying to run properly most likely
amend