refactor js into separate folder