Update CMD application

Added encryption function, tidied up some other lines.