add last() and first() methods