Adding kejiang's code