Added prime check