refacto 3 layers