now using pid class with flock
added postgresql tables