made more readable
added rowVar functions for faster variance calculation