Added implementation of weight calc