Created by: vidartf
Fixes many smaller issues, and introduces changes that I hope should be straight-forward to accept.