final version of first implementation