Moved casts around