implemented logic