developed basic logic