wrap the code for analyzing the first page into a method.