Added a parameter for enabling pidfile usage, modified the setenv template and tweaked some other code