more clean code and fix many problem