Fixed some miscellaneous issues and improved input validation for integers and doubles.