Mainly updated/fixed the routines for computing data for the mongo database to compute lists of aps