reording js functions. no other changes.
updating demo to work with plugins js