used already existing code to create nodes and extended it