Brian's code added