updated codebase and tests

josh and shuotian