add some logic

basic logic