this is the final version

This one works properly