db.close()
replaced a bunch of code with C macros