first right version of the code