click function and filling empty arrays