Refactored, and added node functions.