Add getWeight function #48