refactor werkzeug process detection
add server stop and start hooks