Refactor shakeInputBox