copied pasted/changed seans code to my code to fit my needs