add simple pluralize function, some code cleanup