Corrected the error, reverted code to original with weight added