Remove cast and optimize math
Use subdet name for clarity