altered to use launchctl if available