Fixed bugs and added a full example for render