Quiet PHP_NOTICE by establishing $sidebar
Add comments
Be more cautious before using optional fields
Suppress PHP_NOTICE by using empty()
Rewrap comments
Replace all MDB2 code with PDO code

Per #253.