Added View::encode and misc changes.