holy crap wrote it in one go and it works