Added main implementation & basic tests