Wrote most helper functions, ppal one remaining