code refactor again