Refactor and Optimize... +...

This refactoring and optimization is by littlemousy:

Refactoring and optimize memory footprint. Fix broken "repeat
restrictions on region change", add "RLV_QUERY" and "RLV_RESPONSE"
messages for checking current rlv state, Add support for tracking
restrictions by script: use textString instead of key. Add StartIM
exception.