Merging logic from find_pters.hs into the main project.