Templatify all library stuff