refactor api & add some features