what if this code was replaced with something like this? 
```erlang
code_to_atom(ErrorCode) ->
[H | AtomString] = lists:reverse(lists:foldl(fun(Char, Acc) ->
                                                                case string:to_lower(Char) of
                                                                    Char ->
                                                                          [Char | Acc];
                                                                     Lower ->
                                                                         [Lower, $_ | Acc]
                                                                end
                                                            end, [], ErrorCode))
list_to_atom(AtomString). 
```