fancy javascript and fixing other errors
fix