refactor and reorganiozation