switched to 4 node setup, cleaned up code