Can anyone suggest some clustering algorithm which can work with distance matrix as an input? Or the algorithm which can assess the "goodness" of the clustering also based on the distance matrix?

At this moment I'm using a modification of Kruskal's algorithm (<http://en.wikipedia.org/wiki/Kruskal%27s_algorithm>) to split data into two clusters. It has a problem though. When the data has no distinct clusters the algorithm will still create two clusters with one cluster containing one element and the other containing all the rest. In this case I would rather have one cluster containing all the elements and another one which is empty.

Are there any algorithms which are capable of doing this type of clustering? 

Are there any algorithms which can estimate how well the clustering was done or even better how many clusters are there in the data? 

The algorithms should work only with distance(similarity) matrices as an input.