refactor the api for the latest requirement