Remove unnecessary intermediary variables stotl and rmsvl. Move lines around to group related computations.