Added state checking per message and delete message mehod changes