Removed unnecessary caching.
Added input sanitization.