reduced complicatated code