Added some logic handling stuff