Refactoring: introducing tables to reduce code duplication

Change-Id: I2d205c6ef93e0817d68425305abe2e2ed7c45d66