Move single instance check logic into one file