adding 'last' class for certain elements