add more space effecient method