logic works