Updated with latest version changes to original source by Politecnico di Torino.