make TLS wrapper and refactoring Params.hs