https://github.com/aqingsao/length solution