cleaned up some logic.