Demand-side Flexibility in Smart Grid