Improve check for timeout
Terminate process when timeout reached
accept options as 4th parameter