moved cmessage functions to seperate file and class
renamed functions