huge refactor to include the Prime class and the simplificiation it provides