first attempt at profiling
use connection as a context manager
use string formatter for error messages