lot of work on algorithm done