use b_answer
remove resursive calls, use foldl
remove useless code