Fix chat window scrolling

- Everytime a message is appended to the chatEntries div, the script will also scroll down to the bottom of the div showing the latest message
- Refactor scrolling function