Add boundary checks on input
Add boundary exception tests and profile test