modified it to work