changed js to keep track of the models to be outputted to prevent duplication