Finished version (if you don't like local variables)