algorithm and start apply map