General Code Refactoring

- Only one connection to the database needed, no mysqli_connect();
- Refactored code, removed methods that were not needed. 
- Added three new attributes, also stores the last attempted query for easier resolution if a query should fail.