code from GSoC 2016 by Supun Arunoda (Scooter Morris) and NRNB Academy Summer Session 2015 by Vijay Dhameliya (Scooter Morris)