Splitting cli function from lib