debug some erros resolved better simpler code