Include climits instead of limits.h
Include cstdlib instead of stdlib.h
Remove unnecessary #include
Improve code documentation