Added a function to convert percentages to weights. This fixes #7