Added a way to create new instances and refactored a bit