polishing the interface and fixing some bugs