add tests, find optimal solution for elapsed time