Simple version of the code. Totally broken at the moment.