edited for errors