rewrote frontend engine; not debugged yet