Refactor JS corrigindo bugs (parte 1)