Functionalized electric field, fixed several minor bugs.