Cleaned up functions so it doesn't check classes twice each click.