added a first and last function