fix js file

organize menu structure, fix buggy parts