Changed names
Minor changes and improvements: reduce instability at endpoints
Added N output