Moved code to js folder