Code for  http://www.mdpi.com/1424-8220/12/9/12661