the original logic