convert system() to exec() calls()