Base class created

And some refactors