added naive algo