Bug fixed, code cleanup and import organize