Adjusted implementation to conform to spec