Separate CLI from core, alter structure to simplify use in webapp