Stability PR
Created by: bolmsten
This PR tries to fix a lot of the bugs that was introduced by the two big PR done by me and Matias. I have tried to merge our code and done a bit of cleanup of both code and HTML.
Please take a look and give feedback.