Function called every second on main