encapsulate node functionality in a class