Cleaned up chunk border detection