(this came from Oppositelock but I can't find who posted it to give credit)