added first and last functions