double static cast refactored out