added launch script. Added tests. Refactorization as well