Various bugfixes, ~finished settings window, added comments.