I was kind of unsure about putting this as an inner class but since it's only used here I don't want to make it a standalone class either.