Please take a look at the original model for another implementation. All credits go to the original author.