Refactoring and code changes

This commit is an effort to hit the peak of master of dev@openvswitch.org.

Code was also refactored to improve lisibility.

Hashes were added to improve performance.