working out the prime stuff