some refacoring and preparations for gen4...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>