moved attachment of click listener