adding james's code