move weight functions into their own module