Added extended replacements using dynamic data.

Updated tests.
Updated documentation.
Made one sequence of two ifs an if-else if in index.js