Integration of Energy Storage and Electric Vehicles into the Smart Grid