First real version of this code.