updated comments
changed to try-with-resources
emit log warning if file is invalid
made util method useful for stand-alone usage