moved code to js folder