Logica front end completa