Generalizing/converting classes for use as library