refactored similarity; added printing tables for values in demo