renamed chain length to order
renamed vars
translated to english and updated style to conform to airbnb js guide