Tried to improve type inference, alas.