Abstracted some logic.