added data munging code