Restructure prime.py