Rewrote piece of code

Signed-off-by: Sébastien Bianti <sebastien.bianti@linux.intel.com>