fixed some bugs and cleaned imports