code refactor - part I