improved exception handling and moved parameter validation into controller