made nice weight function