cleaned up main, moved js stuff to separate file