simplified =operator and copy constructor

added helper function copyNodes()