User property_exists instead of isset.
Split DB connection in a new function.
Stop setting config DSN.
Filter count() options