updated electrostat code