New library architecture. tested with simulation.