fixed typo
Updated logic to handle quizes of various lengths. Bug fixes.
Merged with master