Better SQL debugging with backtrace

Optimized the get::option call
Code cleanup