changed from floats to doubles, also added weighted majority vote