Ported all library functions to individual files within lib dir.