cleanup + refactoring
use proper setting for specifying timeout and set default to 500ms