fix features and refactor