Cleanup app and mainwindow

I've tested bitmask using `-s` and seems to work fine. Is that enough?
Most likely when we moved to `flags.STANDALONE` that problem was fixed.