working solution that is too slow