remove the cli code, make this a lib file