Added normalize function and documentation.