This is well covered by Karl over at electricbike-blog