refactor API little bit