tudu code..almost finished