edited weight fn