improve code, less js part