it compiles again and is almost correct