Fixed issue with centroid calculations and cleaned up demos