add length limit, seperate exception handler