Merge Rahul's code, some minor changes, ordinal update.