File md5 check added, small code refactor