use proper thread handling
use settings file