cleaned up codes for errors