changed event listeners, modified animation function using recursion and multiple cookies