Fixed mem leak
Refactoring cstr_copy and adding test
Creating function for validateing element ID strings