add backend interface and refactor code