added elems + mod implementation and tests