Adapted the main.js for both FPO and PatentLens