Added functionality for creating similarity matrix