updated code to handle beta shocks