optimized the code to not rely on arrays and rely on the text-decoration for deletion