made prime method twice as fast