Edited to support new functionalities and removed unused classes