major overall and started some optimization.

thanks to brad for taking a peek over the dbm code. he tore it apart and
has recommended some good changes that i will be working on