Removed useless functions.
Implemented javascript safety.