Moved analyze script to js