Remove deprecated and refactor