added the if line to allow others to use it too