Cleaned up Javascript structure to remove/flatten unnecessary structures & correct structure sensed by IntelliJ