added Node class rather than using hard-coded object structure