Abstracted out some code