improving and adding error messages
fixed a bug with implementing perror
Added stdlib.h