Added queryArray functionality for postgres
Fixed start date calculation for r/s output.
Added some error detection and handling