Refactory code.