Code update and some fixes.