I combined mine and JD's code