Corrected uncomment of test function and moved routine to function
Corrected one-line docstrings
Created weight_calc function and moved routine there