change type of weight and adding validation