changed more helper methods to return a function instead of a string buffer