refactor pcalc ALOT