Removed some unnecessary information and abstracted the variables.