Many fixes. Added settings saving. Made preferences window works. And other.