stolen from hardmath because I am lazy