Final version of the implementation.