Strong refactorization preparing for 5.0.0 version

Change-Id: I4d00db721b17cc88b6b3b0b5ebfa2f3ca34a47b4