Updated implementation with figures