encapsulated code so I don't have to debug stuff I know works