Actually use the pid function
Use variable for pid file