working solution up to 5