change function names, improve formatting