KH-212: Refactored and removed codes relation support

For itself. Codes relation to itself will no longer be allowed in near
future.
Refactor