FEM implementation