Moved some logic.