a bit messier than i thought, but its working