Cleanup, refactoring for selLib