Refactored test into admin function and test
Changed database sessions to handle connection strings