Move logic into main lib file. Throws error now.