Moving some logic around