cleaned up w code
merged
fixed error with target pointer
added function w_test to find w value for test data input