Console improvements (pulled from b9e71c9)
WIP on SQL port (pulled from b9e71c9)