Fixed issue where Inspector fills element's width; JS refactor