basic logic implementation