adds tests; starts implementing the algo logic