Added @Overrides annotation and minor fixes
Improved null checks, closing streams and adding @Overrides