Updates to prevent crazy string reallocation

- Moved charmap to outer scope
- Wrapped plugin in closure
- Created regexp that matches all chars in the charmap
- Used regexps to build the new string in order to prevent excessive memory churn
Merge pull request #1 from mattbasta/patch-1

Updates to prevent crazy string reallocation