Some code refactory.