simplified and reduced code