correct and effective solution