whoo, sort of works, sometimes infinite loop :(