refactor and remove redundant code