Move cop logic to top of file