Applied PEP8
Updated message detection
Preliminary logic added
Logic added