Nitrogen and phosphorus removal for wastewater