Spaces to tabs, and minor code cleanup