tidied some stuff up I think