Small improvements

1) Added compiler optimalization flags dependent on the machine used
2) Always store the pid in a pid file, also when running in debug mode