reorder functions, change example
use old fashioned for loops to maintain ie8 compat
0.2.1