version 2 of the code