Centralize and improve error handling of sub processes (shell commands)
Improve code readability