Add code for setting negative weight