added uninitialized var checking; function sanity checks