implemented parameter validation code. misc cleanup.