Copy from http://git.oschina.net/lionsoul/friso.git