Clean and cut the onions. Fry half amount of the onions for the final decoration. Boil the water for the pasta. In a large pan, fry in 4 tablespoons of olive oil, the remainder amount of the onions. When the onions gets brown add the cod, cut into cubes, the thyme and let cook for two minutes. Then add a ladle of boiling water and continue to cook for another five minutes, covering the pan. Cook the pasta al dente, drain and add it to the cod sauce. Cook until creamy adding walnuts and salt. Serve garnishing with fried onions, thyme and drops of balsamic vinegar.