started coding algorithm