See photo for description, or that large piece of code.