Help- High Pass Filtering Integration Results from Curie101IMU in Dead Reckon

Hi all,

This is my first Arduino project and I've been trying to dead reckon position from the Arduino101 CurieIMU. I'm trying to get a result similar to the one in this video below,

So far I've been able to digitally low pass my accelerometer readings, subtract out the gravity component to get dynamic accelerometer readings(using data Madgwick Visualization Example Code), and implement a digital high pass(I think it is but not sure) using the algorithm below where I first get a Low pass filter result from a given Velocity and subtract that result from the Velocity value.

float getLowFiltered( float input, float EMA_SInput,float EMA_aInput) {
float EMA_SOutput = (input*EMA_aInput) + (1-EMA_aInput)*EMA_SInput;
return EMA_SOutput;
}

I'm not sure this is correct though because when I visualize in Processing it seems as if position will always go back to the origin starting value which happens to be the center. It will track motion without noise pretty well but very quickly always drift back to the center. If I don't High pass the velocity in the method described the drift is too much....

This has all led me to believe that the way I'm implementing this high pass filter is wrong.

Any ideas about what is going wrong?
Thanks