Added tests for controls (validation) and fixed bugs found due to tests.