added spike_matrix, refactoring dist matrix functs