Move logic from draw to state