Added filtering of invalid characters