Code cleanup, reformatting and cli updates.