worked out weight functions