Fixed the code with chomp