Performance fixes & added user input validation tests.