Code cleanup, fixed imports and some bugs