added spec tests and cleaned up variable names