Basic algorithm with output