add possibly optimized solution of advance2