Moved some functionality into methods in charm-cli.py