wow im so stupid i could've coded this from the beginning