configurability, handling errors in sql, template fixes