PEP code refactored (UNTESTED)
Message code refactored (UNTESTED°