Change structure of the module to use it directly as a library