Minor corrections for helper function