breaking up into more helper methods to debug other file types and cleaner code