The first working version of the code.