Renamed two helpers and rearranged code