kinda janky, but i think it works