Add more tests and boundary checks (exception throwing)