now actually works except for the preferences window