finished .js so that it implements the correct information