fixed an api error
merging refactor changes