added sanitize and linkify functions. Moved some js to lib/