Added preferences and remember last used directory