fix issues and add functionalities