implemented first and last