merged matt's code to master