first scketch of complete code