refactor and feature adding