Small scala API refactoring