Add comments and improve testing

Complete file and functions documentations as well as improve in code
testing calls