Fix forIn rather than each for iterating on object
Merge pull request #2604 from overlookmotel/fix-forIn-over-object

Fix forIn rather than each for iterating on object
Mark a pg connection as invalid on connection err. Builds on PR #2557 by @jawj
Restructured docs generator