added prime number checking