Restructure lib classes