converted the first and last pointers to methods that respect locking