Initial working version of CLI and API