Cleaned up a few useless statements, calculate total N