updated the identity matrix algorithm with new and improved.