updated annex finally to support different databases