Revert "put clear arrays inside a function"

This reverts commit 70c5a6eca71198f2c9dd0b21643af71823f9a41c.