Seperate code into main and api and adjust default cli options