removed unused and duplicated code