Refactorized lib package to fix (future) cyclic import problems