Refactor dependencies and environment.rb to get postgresql to work as expected.