Added beta clustering code