Code refactored and dxvectors added to pass values to shader