Split cli and lib into separate modules