refactor and add feature