added prime, refactoring