Bug fixing

A few changes has been done such as improving naming and the chat stuck bug.