cleanup unnecessary code, move to more clean implementation