working solution
small changes