Added advanced features, including switching db to pg