Move FPA computation to FPA.hs and refactor legacy FPA modules