Add interpolation for smoother motion and add comments to modified code