Re-worked some of the logic

Re-worked Sql Queries
Added log files
Created a DB Factory
Re-worked the recover password system. Now it's fully functional.
Although not tested.
Re-worked the _installation part