Refactored first and last scroll node check methods.