Update.

partial code clean up and BT fixes.