global refactoring
use exec instead of spawn
improve test