Extra cleanup; Addition of errors.h
Mem leak fix