added more database query functions to implement in the pm.rb