slightly faster weight implementation