decided to use my brain and fix my broken code
works a treat