Split nodes into local and remote and moved command definition and environment registration into definition class