Re-used the code from phoenix ...thanks to phoenix this addon wouldnt have existed